package com.joolun.cloud.upms.admin.controller;

import com.aliyuncs.exceptions.ClientException;
import com.joolun.cloud.common.core.constant.CommonConstants;
import com.joolun.cloud.common.data.tenant.TenantContextHolder;
import com.joolun.cloud.upms.admin.service.PhoneService;
import com.joolun.cloud.common.core.util.R;
import com.joolun.cloud.upms.admin.service.SysTenantService;
import com.joolun.cloud.upms.admin.service.SysUserService;
import com.joolun.cloud.upms.common.dto.UserInfo;
import com.joolun.cloud.upms.common.entity.SysTenant;
import com.joolun.cloud.upms.common.entity.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.joolun.cloud.common.security.annotation.Inside;

/**
 * @author www.joolun.com
 * @date 2018/11/14
 * <p>
 * 手机验证码
 */
@RestController
@AllArgsConstructor
@RequestMapping("/phone")
@Api(value = "phone", tags = "手机登录管理模块")
public class PhoneController {
	private final PhoneService phoneService;

	/**
	 * 发送手机验证码
	 * @param phone
	 * @return
	 * @throws ClientException
	 */
	@Inside(value = false)
	@PutMapping("/code")
	public R sendSmsCode(String phone, String type) throws ClientException {
		return phoneService.sendSmsCode(phone,type);
	}

}
